package com.ruoyi.quartz.service.impl;

import com.ruoyi.quartz.domain.*;
import com.ruoyi.quartz.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class DataCleanServiceImpl implements IDataCleanService {

    private static final Logger logger = LoggerFactory.getLogger(DataCleanServiceImpl.class);

    @Autowired
    private IYongyouXshtService xshtService;

    @Autowired
    private ICgImportMainService cgImportMainService;

    @Autowired
    private ICgImportMainIntermediateService intermediateService;

    @Autowired
    private ICgImportMainService mainService;

    @Autowired
    private ICgImportMainDetailService mainDetailService;

    @Autowired
    private IYjgCgMainService cgMainService;

    @Autowired
    private IYjgCgMainBi1Service cgMainBi1Service;

    @Autowired
    private IYjgCgMainBi2Service cgMainBi2Service;

    @Autowired
    private IYjgCgMainBi3Service cgMainBi3Service;

    @Autowired
    private IYjgCgMainBi4Service cgMainBi4Service;

    @Autowired
    private ICgImportYjgMainService yjgMainService;

    @Autowired
    private IYjgZzDqkcService yjgZzDqkcService;

    @Autowired
    private IYmdCgBaseService ymdCgBaseService;

    @Autowired
    private ICdOrderMainService cdOrderMainService;

    @Autowired
    private ICgZqbcMainService cgZqbcMainService;

    @Override
    public void cgDataClean() {
        // 一、采购主表
        SimpleDateFormat sdfm = new SimpleDateFormat("yyyy");
        String year = sdfm.format(new Date());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat sdft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        mainService.clearCgImportMain(year);
        List<Map<String,Object>> list = xshtService.getYjgXsht(year);
        if(list.size()>0){
            for (Map<String,Object> map : list) {
                CgImportMain main = new CgImportMain();
                main.setUpdateTime(new Date());
                Date yyfhdate = null;
                Date qddata = null;
                Date consigntime = null;
                try {
                    yyfhdate = sdf.parse(map.get("fh_date").toString());
                    qddata = sdf.parse(map.get("qd_date").toString());
                    consigntime = sdf.parse(map.get("consigntime").toString());
                }catch (Exception e){
                    e.printStackTrace();
                }
                main.setQdDate(qddata);
                main.setYongyouFhDate(yyfhdate);
                main.setCreatetime(consigntime);
                main.setRealproductcode(map.get("realproductcode").toString());
                main.setYongyouName(map.get("skuname").toString());
                main.setSaledepartmentidName(map.get("saledepartmentid_name").toString());
                main.setCorpcontactusername(map.get("corpcontactusername").toString());
                main.setOrderdetailsFirstupcode(map.get("orderdetails_firstupcode").toString());
                main.setCreateTime(new Date());
                main.setAgentidName(map.get("agentId_name").toString());
                BigDecimal subqty = new BigDecimal(map.get("subqty").toString());
                BigDecimal orisum = new BigDecimal(map.get("orisum").toString());
                main.setZmNums(subqty);
                main.setTotalPrice(orisum);
                List<Map<String,Object>> wesDayInfo = cgImportMainService.getWesDay(map.get("fh_date").toString());
                if(wesDayInfo.size()>0){
                    if(wesDayInfo.get(0)!=null){
                        Date w3 = null;
                        try {
                            w3 = sdf.parse(wesDayInfo.get(0).get("w3").toString());
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                        main.setFhDate(w3);
                    }
                }
                main.setType0("洋桔梗");
                List<Map<String,Object>> cpDims = cgImportMainService.getCpDims(map.get("realproductcode").toString());
                if(cpDims.size()>0){
                    if(cpDims.get(0)!=null){
                        if(cpDims.get(0).get("cg_name_cn")!=null){
                            main.setCgNameCn(cpDims.get(0).get("cg_name_cn").toString());
                        }
                        if (cpDims.get(0).get("mem_code")!=null){
                            main.setMemCode(cpDims.get(0).get("mem_code").toString());
                        }
                        if (cpDims.get(0).get("type2")!=null){
                            main.setType2(cpDims.get(0).get("type2").toString());
                        }
                        if (cpDims.get(0).get("type3")!=null){
                            main.setType3(cpDims.get(0).get("type3").toString());
                        }
                        if (cpDims.get(0).get("type1")!=null){
                            main.setType1(cpDims.get(0).get("type1").toString());
                        }
                        if (cpDims.get(0).get("cp_en_name")!=null){
                            main.setCpEnName(cpDims.get(0).get("cp_en_name").toString());
                        }
                        if (cpDims.get(0).get("sup_en_name")!=null){
                            main.setSupEnName(cpDims.get(0).get("sup_en_name").toString());
                        }
                        if (cpDims.get(0).get("sup_cn_name")!=null){
                            main.setSupCnName(cpDims.get(0).get("sup_cn_name").toString());
                        }
                    }
                }else{
                    main.setCgNameCn("无");
                    main.setMemCode("无");
                    main.setType2("无");
                    main.setType3("无");
                    main.setType1("洋桔梗-未关联到维表");
                    main.setCpEnName("无");
                    main.setSupEnName("无");
                    main.setSupCnName("无");
                }
                if(map.get("skuname")!=null){
                    String spec = "";
                    if(map.get("skuname").toString().endsWith("1276穴")){
                        spec = "1276穴";
                    }else if(map.get("skuname").toString().endsWith("1014穴")){
                        spec = "1014穴";
                    }else if(map.get("skuname").toString().endsWith("864穴")){
                        spec = "864穴";
                    }else {
                        spec = null;
                    }
                    BigDecimal specNum = new BigDecimal(0);
                    if(spec!=null){
                        BigDecimal num = new BigDecimal(spec.replaceAll("穴",""));
                        specNum = num.multiply(new BigDecimal(map.get("subqty").toString()));
                    }else{
                        specNum = new BigDecimal(map.get("subqty").toString()).multiply(new BigDecimal(0));
                    }
                    main.setSpec(spec);
                    main.setZzNums(specNum);
                }
                mainService.insertCgImportMain(main);
            }
        }
        // 其他种类
        List<Map<String,Object>> otherList = xshtService.getOtherXsht(year);
        if(otherList.size()>0){
            for(Map<String,Object> map : otherList){
                String typeName = "";
                if(map.get("skuname")!=null||map.get("skuname").toString().length()==0){
                    if(map.get("skuname").toString().indexOf("-")>0){
                        typeName = map.get("skuname").toString().substring(0,map.get("skuname").toString().indexOf("-"));
                        if(typeName.indexOf(" ")>0){
                            typeName = typeName.substring(0,typeName.indexOf(" "));
                        }
                    }else{
                        typeName = map.get("skuname").toString();
                    }
                }else{
                    typeName = map.get("skuname").toString();
                }
                CgImportMain main = new CgImportMain();
                main.setUpdateTime(new Date());
                Date yyfhdate = null;
                Date qddata = null;
                Date consigntime = null;
                try {
                    yyfhdate = sdf.parse(map.get("fh_date").toString());
                    qddata = sdf.parse(map.get("qd_date").toString());
                    consigntime = sdf.parse(map.get("consigntime").toString());
                }catch (Exception e){
                    e.printStackTrace();
                }
                main.setQdDate(qddata);
                main.setYongyouFhDate(yyfhdate);
                main.setFhDate(yyfhdate);
                main.setCreatetime(consigntime);
                main.setRealproductcode(map.get("realproductcode").toString());
                main.setYongyouName(map.get("skuname").toString());
                main.setSaledepartmentidName(map.get("saledepartmentid_name").toString());
                main.setCorpcontactusername(map.get("corpcontactusername").toString());
                main.setOrderdetailsFirstupcode(map.get("orderdetails_firstupcode").toString());
                main.setCreateTime(new Date());
                main.setAgentidName(map.get("agentId_name").toString());
                BigDecimal subqty = new BigDecimal(map.get("subqty").toString());
                BigDecimal orisum = new BigDecimal(map.get("orisum").toString());
                main.setZmNums(subqty);
                main.setZzNums(subqty);
                main.setTotalPrice(orisum);
                main.setType0(typeName);
                List<Map<String,Object>> cpDims = cgImportMainService.getCpDims(map.get("realproductcode").toString());
                if(cpDims.size()>0){
                    if(cpDims.get(0)!=null){
                        if(cpDims.get(0).get("cg_name_cn")!=null){
                            main.setCgNameCn(cpDims.get(0).get("cg_name_cn").toString());
                        }
                        if (cpDims.get(0).get("mem_code")!=null){
                            main.setMemCode(cpDims.get(0).get("mem_code").toString());
                        }
                        if (cpDims.get(0).get("type2")!=null){
                            main.setType2(cpDims.get(0).get("type2").toString());
                        }
                        if (cpDims.get(0).get("type3")!=null){
                            main.setType3(cpDims.get(0).get("type3").toString());
                        }
                        if (cpDims.get(0).get("type1")!=null){
                            main.setType1(cpDims.get(0).get("type1").toString());
                        }
                        if (cpDims.get(0).get("cp_en_name")!=null){
                            main.setCpEnName(cpDims.get(0).get("cp_en_name").toString());
                        }
                        if (cpDims.get(0).get("sup_en_name")!=null){
                            main.setSupEnName(cpDims.get(0).get("sup_en_name").toString());
                        }
                        if (cpDims.get(0).get("sup_cn_name")!=null){
                            main.setSupCnName(cpDims.get(0).get("sup_cn_name").toString());
                        }
                        if (cpDims.get(0).get("spec")!=null){
                            main.setSpec(cpDims.get(0).get("spec").toString());
                        }
                    }
                }else{
                    main.setCgNameCn("无");
                    main.setMemCode("无");
                    main.setType2("无");
                    main.setType3("无");
                    main.setType1(typeName+"-未关联到维表");
                    main.setCpEnName("无");
                    main.setSupEnName("无");
                    main.setSupCnName("无");
                    main.setSpec("无");
                }
                mainService.insertCgImportMain(main);
            }
        }
        // 二、采购主表明细表
        mainDetailService.deleteCgImportMainDetailByYear(year);
        List<Map<String,Object>> detailList = xshtService.getDetailXsht(year);
        if(detailList.size()>0){
            for(Map<String,Object> xsht:detailList){
                CgImportMainDetail detail = new CgImportMainDetail();
                if(xsht.get("update_time")!=null){
                    detail.setUpdateTime(new Date());
                }
                if(xsht.get("yongyou_htcode")!=null){
                    detail.setYongyouHtcode(xsht.get("yongyou_htcode").toString());
                }
                if(xsht.get("fh_date")!=null){
                    detail.setFhDate(xsht.get("fh_date").toString());
                }
                if(xsht.get("ht_date")!=null){
                    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
                    Date date = null;
                    try {
                        date = formatter.parse(xsht.get("ht_date").toString());
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                    detail.setHtDate(date);
                }
                if(xsht.get("createtime")!=null){
                    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    Date date = null;
                    try {
                        date = formatter.parse(xsht.get("createtime").toString());
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                    detail.setCreatetime(date);
                }
                if(xsht.get("sale_name")!=null){
                    detail.setSaleName(xsht.get("sale_name").toString());
                }
                if(xsht.get("department")!=null){
                    detail.setDepartment(xsht.get("department").toString());
                }
                if(xsht.get("customer_name")!=null){
                    detail.setCustomerName(xsht.get("customer_name").toString());
                }
                if(xsht.get("yongyou_code")!=null){
                    detail.setYongyouCode(xsht.get("yongyou_code").toString());
                }
                if(xsht.get("yongyou_name")!=null){
                    detail.setYongyouName(xsht.get("yongyou_name").toString());
                }
                if(xsht.get("nums")!=null){
                    detail.setNums(new BigDecimal(xsht.get("nums").toString()));
                }
                if(xsht.get("qtyname")!=null){
                    detail.setQtyname(xsht.get("qtyname").toString());
                }
                if(xsht.get("price")!=null){
                    detail.setPrice(new BigDecimal(xsht.get("price").toString()));
                }
                if(xsht.get("order_status")!=null){
                    detail.setOrderStatus(xsht.get("order_status").toString());
                }
                if(xsht.get("pay_status")!=null){
                    detail.setPayStatus(xsht.get("pay_status").toString());
                }
                if(xsht.get("mem_code")!=null){
                    detail.setMemCode(xsht.get("mem_code").toString());
                }
                if(xsht.get("type_0")!=null){
                    detail.setType0(xsht.get("type_0").toString());
                }
                if(xsht.get("create_time")!=null){
                    detail.setCreateTime(new Date());
                }
                if(xsht.get("fh_date_label")!=null){
                    detail.setFhDateLabel(xsht.get("fh_date_label").toString());
                }
                mainDetailService.insertCgImportMainDetail(detail);
            }
        }
        // 三、采购量主表
        cgMainService.deleteDataByYear(year);
        List<Map<String,Object>> yjgCgMainData = cgMainService.selectYjgCgMainData(year);
        if(yjgCgMainData.size()>0){
            for (Map<String,Object> yjgCg : yjgCgMainData) {
                YjgCgMain cg = new YjgCgMain();
                if(yjgCg.get("consigntime")!=null){
                    cg.setConsigntime(yjgCg.get("consigntime").toString());
                }
                if(yjgCg.get("mem_code")!=null){
                    cg.setMemCode(yjgCg.get("mem_code").toString());
                }
                if(yjgCg.get("cg_name_cn")!=null){
                    cg.setCgNameCn(yjgCg.get("cg_name_cn").toString());
                }
                if(yjgCg.get("type2")!=null){
                    cg.setType2(yjgCg.get("type2").toString());
                }
                if(yjgCg.get("type3")!=null){
                    cg.setType3(yjgCg.get("type3").toString());
                }
                if(yjgCg.get("rn")!=null){
                    cg.setRn(yjgCg.get("rn").toString());
                    if(Long.parseLong(yjgCg.get("rn").toString())==1){
                        if(yjgCg.get("tt_nums")!=null){
                            cg.setTtNums(Long.parseLong(yjgCg.get("tt_nums").toString().replaceAll("\\.0","").replaceAll("\\.00","")));
                        }else{
                            cg.setTtNums(0L);
                        }
                    }else{
                        cg.setTtNums(0L);
                    }
                }
                cgMainService.insertYjgCgMain(cg);
            }
        }

        // 四、采购量主表清洗
        cgMainService.deleteCgImportYjgMainByYear(year);
        List<Map<String,Object>> cgYjgMainData = cgMainService.selectCgYjgMainData(year);
        if(cgYjgMainData.size()>0){
            for (Map<String,Object> cgYjg : cgYjgMainData) {
                CgImportYjgMain cg = new CgImportYjgMain();
                if(cgYjg.get("consigntime")!=null){
                    cg.setConsigntime(cgYjg.get("consigntime").toString());
                }
                if(cgYjg.get("rn")!=null){
                    cg.setRn(cgYjg.get("rn").toString());
                }
                if(cgYjg.get("mem_code")!=null){
                    cg.setMemCode(cgYjg.get("mem_code").toString());
                }
                if(cgYjg.get("cg_name_cn")!=null){
                    cg.setCgNameCn(cgYjg.get("cg_name_cn").toString());
                }
                if(cgYjg.get("type2")!=null){
                    cg.setType2(cgYjg.get("type2").toString());
                }
                if(cgYjg.get("type3")!=null){
                    cg.setType3(cgYjg.get("type3").toString());
                }
                if(cgYjg.get("xs_nums")!=null){
                    cg.setXsNums(new BigDecimal(cgYjg.get("xs_nums").toString()));
                }
                if(cgYjg.get("dq_kc")!=null){
                    cg.setDqKc(Long.parseLong(cgYjg.get("dq_kc").toString().replaceAll("\\.0","").replaceAll("\\.00","")));
                }
                yjgMainService.insertCgImportYjgMain(cg);
            }
        }
        // 五、当期结存库存
        List<Map<String,Object>> yjgDqkc = cgMainService.selectJygDqkcData();
        yjgZzDqkcService.deleteYjgZzDqkcByYear(year);
        if(yjgDqkc.size()>0){
            for(Map<String,Object> map : yjgDqkc){
                YjgZzDqkc dqkc = new YjgZzDqkc();
                if(map.get("consigntime")!=null){
                    dqkc.setConsigntime(map.get("consigntime").toString());
                }
                if(map.get("rn")!=null){
                    dqkc.setRn(map.get("rn").toString());
                }
                if(map.get("mem_code")!=null){
                    dqkc.setMemCode(map.get("mem_code").toString());
                }
                if(map.get("cg_name_cn")!=null){
                    dqkc.setCgNameCn(map.get("cg_name_cn").toString());
                }
                if(map.get("type2")!=null){
                    dqkc.setType2(map.get("type2").toString());
                }
                if(map.get("type3")!=null){
                    dqkc.setType3(map.get("type3").toString());
                }
                if(map.get("xs_nums")!=null){
                    dqkc.setXsNums(new BigDecimal(map.get("xs_nums").toString().replaceAll("\\.0","").replaceAll("\\.00","")));
                }
                if(map.get("dq_kc")!=null){
                    dqkc.setDqKc(Long.parseLong(map.get("dq_kc").toString().toString().replaceAll("\\.0","").replaceAll("\\.00","")));
                }
                yjgZzDqkcService.insertYjgZzDqkc(dqkc);
            }
        }
    }

    @Override
    public void cgZQDataClean(){
        SimpleDateFormat sdfm = new SimpleDateFormat("yyyy");
        String year = sdfm.format(new Date());
        String day = sdfm.format(new Date())+"-01-01";
        List<Map<String,Object>> list = xshtService.selectJianLan(year,day);
        if(list.size()>0){
            ymdCgBaseService.deleteYmdCgBaseByPreDate(year);
            for(Map<String,Object> map : list){
                YmdCgBase ymd = new YmdCgBase();
                if(map.get("xd_cycle")!=null){
                    ymd.setXdCycle(map.get("xd_cycle").toString());
                }
                if(map.get("company")!=null){
                    ymd.setCompany(map.get("company").toString());
                }
                if(map.get("ordercode")!=null){
                    ymd.setOrdercode(map.get("ordercode").toString());
                }
                if(map.get("salename")!=null){
                    ymd.setSalename(map.get("salename").toString());
                }
                if(map.get("agentId_name")!=null){
                    ymd.setAgentidName(map.get("agentId_name").toString());
                }
                if(map.get("dpt")!=null){
                    ymd.setDpt(map.get("dpt").toString());
                }
                if(map.get("pubuts")!=null){
                    ymd.setPubuts(map.get("pubuts").toString());
                }
                if(map.get("predate")!=null){
                    ymd.setPredate(map.get("predate").toString());
                }
                if(map.get("pcode")!=null){
                    ymd.setPcode(map.get("pcode").toString());
                }
                if(map.get("pname")!=null){
                    ymd.setPname(map.get("pname").toString());
                }
                if(map.get("subqty")!=null){
                    ymd.setSubqty(map.get("subqty").toString());
                }
                if(map.get("orisum")!=null){
                    ymd.setOrisum(map.get("orisum").toString());
                }
                if(map.get("statuscode")!=null){
                    ymd.setStatuscode(map.get("statuscode").toString());
                }
                if(map.get("yongyou_code")!=null){
                    ymd.setYongyouCode(map.get("yongyou_code").toString());
                }
                if(map.get("cp_en_name")!=null){
                    ymd.setCpEnName(map.get("cp_en_name").toString());
                }
                if(map.get("brand")!=null){
                    ymd.setBrand(map.get("brand").toString());
                }
                if(map.get("xlname")!=null){
                    ymd.setXlname(map.get("xlname").toString());
                }
                if(map.get("colour")!=null){
                    ymd.setColour(map.get("colour").toString());
                }
                if(map.get("sup_en_name")!=null){
                    ymd.setSupEnName(map.get("sup_en_name").toString());
                }
                if(map.get("spec")!=null){
                    ymd.setSpec(map.get("spec").toString());
                }
                ymdCgBaseService.insertYmdCgBase(ymd);
            }
        }

        List<Map<String,Object>> cdMainList = cdOrderMainService.selectCdOrderMainData();
        if(cdMainList.size()>0){
            cdOrderMainService.clearCdOrderMain();
            for (Map<String,Object> map : cdMainList) {
                CdOrderMain cdOrder = new CdOrderMain();
                if(map.get("fdate")!=null){
                    cdOrder.setFdate(map.get("fdate").toString());
                }
                if(map.get("pcode")!=null){
                    cdOrder.setPcode(map.get("pcode").toString());
                }
                if(map.get("qty")!=null){
                    cdOrder.setQty(map.get("qty").toString());
                }
                if(map.get("sqty")!=null){
                    cdOrder.setSqty(map.get("sqty").toString());
                }
                if (map.get("rn")!=null){
                    cdOrder.setRn(map.get("rn").toString());
                }
                if (map.get("yongyou_code")!=null){
                    cdOrder.setYongyouCode(map.get("yongyou_code").toString());
                }
                if (map.get("brand")!=null){
                    cdOrder.setBrand(map.get("brand").toString());
                }
                if (map.get("colour")!=null){
                    cdOrder.setColour(map.get("colour").toString());
                }
                if (map.get("spec")!=null){
                    cdOrder.setSpec(map.get("spec").toString());
                }
                if (map.get("yyname")!=null){
                    cdOrder.setYyname(map.get("yyname").toString());
                }
                if(map.get("cp_en_name")!=null){
                    cdOrder.setCpEnName(map.get("cp_en_name").toString());
                }
                cdOrderMainService.insertCdOrderMain(cdOrder);
            }
        }

        List<Map<String,Object>> cgbc1 = cgZqbcMainService.selectCgZqbcData1();
        if(cgbc1.size()>0){
            cgZqbcMainService.clearCgZqbcData();
            for(Map<String,Object> map : cgbc1){
                CgZqbcMain zqbc = new CgZqbcMain();
                if(map.get("fdate")!=null){
                    zqbc.setFdate(map.get("fdate").toString());
                }
                if(map.get("pcode")!=null){
                    zqbc.setPcode(map.get("pcode").toString());
                }
                if(map.get("qty")!=null){
                    zqbc.setQty(map.get("qty").toString());
                }
                if(map.get("sqty")!=null){
                    zqbc.setSqty(map.get("sqty").toString());
                }
                if(map.get("rn")!=null){
                    zqbc.setRn(map.get("rn").toString());
                }
                if(map.get("yongyou_code")!=null){
                    zqbc.setYongyouCode(map.get("yongyou_code").toString());
                }
                if(map.get("brand")!=null){
                    zqbc.setBrand(map.get("brand").toString());
                }
                if(map.get("colour")!=null){
                    zqbc.setColour(map.get("colour").toString());
                }
                if(map.get("spec")!=null){
                    zqbc.setSpec(map.get("spec").toString());
                }
                if(map.get("yyname")!=null){
                    zqbc.setYyname(map.get("yyname").toString());
                }
                if(map.get("bcqty")!=null){
                    zqbc.setBcqty(map.get("bcqty").toString());
                }
                if(map.get("gxtime")!=null){
                    zqbc.setGxtime(map.get("gxtime").toString());
                }
                if(map.get("cp_en_name")!=null){
                    zqbc.setCpEnName(map.get("cp_en_name").toString());
                }
                if(map.get("cg_qty")!=null){
                    zqbc.setCgQty(map.get("cg_qty").toString());
                }
                cgZqbcMainService.insertCgZqbcMain(zqbc);
            }
            List<Map<String,Object>> cgbc2 = cgZqbcMainService.selectCgZqbcData2();
            if(cgbc2.size()>0){
                for(Map<String,Object> map : cgbc2){
                    CgZqbcMain zqbc = new CgZqbcMain();
                    if(map.get("fdate")!=null){
                        zqbc.setFdate(map.get("fdate").toString());
                    }
                    if(map.get("pcode")!=null){
                        zqbc.setPcode(map.get("pcode").toString());
                    }
                    if(map.get("qty")!=null){
                        zqbc.setQty(map.get("qty").toString());
                    }
                    if(map.get("sqty")!=null){
                        zqbc.setSqty(map.get("sqty").toString());
                    }
                    if(map.get("rn")!=null){
                        zqbc.setRn(map.get("rn").toString());
                    }
                    if(map.get("yongyou_code")!=null){
                        zqbc.setYongyouCode(map.get("yongyou_code").toString());
                    }
                    if(map.get("brand")!=null){
                        zqbc.setBrand(map.get("brand").toString());
                    }
                    if(map.get("colour")!=null){
                        zqbc.setColour(map.get("colour").toString());
                    }
                    if(map.get("spec")!=null){
                        zqbc.setSpec(map.get("spec").toString());
                    }
                    if(map.get("yyname")!=null){
                        zqbc.setYyname(map.get("yyname").toString());
                    }
                    if(map.get("bcqty")!=null){
                        zqbc.setBcqty(map.get("bcqty").toString());
                    }
                    if(map.get("gxtime")!=null){
                        zqbc.setGxtime(map.get("gxtime").toString());
                    }
                    if(map.get("cp_en_name")!=null){
                        zqbc.setCpEnName(map.get("cp_en_name").toString());
                    }
                    if(map.get("cg_qty")!=null){
                        zqbc.setCgQty(map.get("cg_qty").toString());
                    }
                    cgZqbcMainService.insertCgZqbcMain(zqbc);
                }
            }
        }
    }
}
